1. Field of the Invention
The present invention relates to an image processing apparatus and an image processing method that decode compressed and coded image data.
2. Description of the Related Art
An image forming apparatus, such as a printer, temporarily stores image data in a memory. In this case, when the image data is stored in the memory without any change, a high-capacity memory is needed, which results in an increase in cost. In order to solve this problem, the image data is compressed and is then stored in the memory.
For example, a print process of the printer is performed as follows. The printer receives a page description language (PDL) which is created by, for example, a computer through a network and analyzes the PDL to generate an intermediate language that can be executed by a drawing unit. A drawing unit analyzes the intermediate language and draws an image subjected to gradation processing to a band memory. The drawn image data is compressed and coded by a binary image compression coding algorithm, and the generated code data is stored in the memory. Thereafter, during a print operation, the code data is read from the memory while being delayed for each of C, M, Y, and K and the read code data is decoded. Then, the data corresponding to each of C, M, Y, and K is transmitted to the printer engine and is then printed.
As a method of effectively performing compression coding on a binary image, there has been known a compression coding method using a variable-length code. For the variable-length code, a short code is allocated to a value with a high frequency of appearance, and the allocated code length increases as the frequency of appearance is reduced. In this way, data is compressed.
For the variable-length code, there is a concern that the codes after the error position cannot be normally decoded when an error is mixed with the code in, for example, a transmission path. In order to prevent the mixture of an error with the code, Japanese Patent Application Laid-open No. 2003-233396 discloses a technique in which a synchronization code is inserted into a packet having bit streams divided by variable-length codes therein, thereby preventing the transmission of the error of the code.
However, for example, in an ink jet printer, when printing is performed with the amount of ink more than a predetermined value, a sheet is loosened by ink and a sheet discharge problem is likely to occur. The program is particularly serious in double-side printing. Therefore, Japanese Patent Application Laid-open No. 2007-091398 discloses a technique that regulates the total amount of ink discharged during double-side printing to prevent a sheet discharge problem during double-side printing.
The method of regulating the total amount of ink is applicable to a printer that performs printing with toner, in addition to the ink jet printer. That is, it is possible to reduce the load of a printing mechanism by limiting the total amount of toner attached to each of the C, M, Y, and K plates.
During compression coding with the variable-length code, generally, the syntax error of the code is recognized when a code that is absent in the code table, that is, a code to which no data value is allocated is decoded. In the coding process, in order to effectively perform coding, the codes are sequentially arranged as consecutively as possible in increasing order of a code length, and codes that are absent in the code table have very long code lengths. Since a code with a short code length has a very low frequency of appearance, incorrect codes are likely to be decoded from the point of time when an error actually occurs, when the syntax error is recognized. In the case of the printer, there is a concern that print quality will deteriorate.
For example, a printer connected to a network receives codes from a printer server, sequentially decodes the received codes, and performs printing. In this case, the transmission path of the codes is generally a wire and a CRC (cyclic redundancy check) code is added to increase error tolerance. Therefore, a code error is less likely to occur in the transmission system. In the printer connected to the network, it is considered that an error occurs due to, for example, an error in the process of creating codes in the printer server, the difference in specifications between the printer and the printer server, or a hardware defect.
In Japanese Patent Application Laid-open No. 2003-233396, the synchronization code is detected from the packet that has caused an error and the decoding of the code is resumed from the next packet, thereby continuously reproducing bit streams. Japanese Patent Application Laid-open No. 2003-233396 discloses a solution when an error occurs in a packet skip process and it is considered that no problem arises even when the packet having an error is discarded.
However, basically, the printer should not perform defective printing. Therefore, it is difficult to perform the process of discarding the packet with an error and decoding the next packet, thereby continuously reproducing bit streams, as in Japanese Patent Application Laid-open No. 2003-233396.
As described above, since the syntax error is recognized by the code with a very long code length, many incorrect codes are likely to be decoded from the position where an error actually occurs. The image data decoded from the incorrect codes is beyond the restriction of the total amount of ink discharged or the total amount of toner adhered and there is a concern that an unnecessary load will be applied to the printing mechanism. In particular, in the ink jet printer, when printing is performed with more than a predetermined amount of ink, there is a concern that a large load will be applied to the printing mechanism due to, for example, the curling of the sheet during the discharge of the sheet, as described above.